/*
 * Copyright (C) 2010-2011 Comcast Cable.  All Rights Reserved.
 */
package com.hercules.android.receiver.model.events;

/**
 * <p>This is a subclass of XREEvent that represents the "onChanged" text event. It defines some properties specific to
 * this event. Note that values of all custom properties are actually stored in the XREEvent#params map.</p>
 *
 * <p><strong>Thread safety:</strong> This class is mutable and not thread safe.</p>
 *
 * @author saarixx, jmn
 * @version 1.0
 */
public class XRETextInputEvent extends XREResourceEvent {

    /**
     * <p>Represents the name of the "on text changed" event.</p>
     *
     * <p>This is a string constant used by the user when setting the name of the event.</p>
     */
    public static final String ON_CHANGED_EVENT_NAME = "onChanged";

    /**
     * <p>Represents the name used to retrieve the text parameter.</p>
     */
    private static final String TEXT = "text";

    /**
     * <p>Creates new instance of {@link XRETextInputEvent} class.</p>
     */
    public XRETextInputEvent() {
        // empty constructor
    }

    /**
     * <p>Retrieves the new text value.</p>
     *
     * @return the new text value
     *
     * @throws IllegalStateException if the requested parameter has wrong type in the parameters map or params is null
     */
    public String getText() {
        return getTypedParam(TEXT, String.class);
    }

    /**
     * <p>Sets the new text value.</p>
     *
     * @param text the new text value
     *
     * @throws IllegalStateException if params is null
     */
    public void setText(String text) {
        setParam(TEXT, text);
    }
}

